package com.trg.generaltool.service.rabbitmq.conform.route;

import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @ClassName: CustomerRouting
 * @Description:
 * @Author: tangrg
 * @Date: 2021/7/19 16:35
 * @Version: 1.0
 * @Return:
 **/
@Component
public class CustomerRouting {

    @RabbitListener(
            bindings = @QueueBinding(
                    value = @Queue,//指定默认队列名称
                    exchange = @Exchange(value = "direct",type = "direct"),//指定交换机名称
                    key = {"info","error","waring"}
            ))
    public void receive(String msg){
        System.out.println("msg1:" + msg);
    }

    @RabbitListener(
            bindings = @QueueBinding(
                    value = @Queue,//指定默认队列名称
                    exchange = @Exchange(value = "direct",type = "direct"),//指定交换机名称
                    key = {"error"}
            ))
    public void receive2(String msg){
        System.out.println("msg2:" + msg);
    }

    @RabbitListener(
            bindings = @QueueBinding(
                    value = @Queue,//指定默认队列名称
                    exchange = @Exchange(value = "direct",type = "direct"),//指定交换机名称
                    key = {"waring"}
            ))
    public void receive3(String msg){
        System.out.println("msg3:" + msg);
    }


  /*  @RabbitListener(queuesToDeclare = @Queue(),
    bindings = @QueueBinding(exchange = @Exchange(arguments = @Argument())))
    public void rece4(String msg){

    }*/
}
